/* _reset.scss */
@use "./variables" as *;

/* ===== 基础重置 ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== HTML & Body ===== */
html {
  height: 100%;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  height: 100%;
  line-height: $line-height-normal;
  font-family: $font-family-base;
  font-size: $font-size-base;
  color: $color-text-primary;
  background-color: $bg-color-layout;
  overflow-x: hidden;
}

/* ===== 根容器 ===== */
#app {
  height: 100%;
  min-height: 100vh;
}

/* ===== 链接 ===== */
a {
  text-decoration: none;
  color: inherit;
  transition: color $transition-fast;

  &:hover {
    color: $color-primary;
  }

  &:focus {
    outline: 2px solid $color-primary;
    outline-offset: 2px;
  }
}

/* ===== 列表 ===== */
ul,
ol {
  list-style: none;
}

/* ===== 媒体元素 ===== */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ===== 表单元素 ===== */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  transition: all $transition-fast;

  &:disabled {
    cursor: not-allowed;
    opacity: 0.6;
  }
}

/* ===== 标题 ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: $font-weight-semibold;
  line-height: $line-height-tight;
  color: $color-text-primary;
}

h1 {
  font-size: $font-size-3xl;
}
h2 {
  font-size: $font-size-2xl;
}
h3 {
  font-size: $font-size-xl;
}
h4 {
  font-size: $font-size-lg;
}
h5 {
  font-size: $font-size-base;
}
h6 {
  font-size: $font-size-sm;
}

/* ===== 段落 ===== */
p {
  line-height: $line-height-normal;
  color: $color-text-secondary;
}

/* ===== 代码 ===== */
code,
pre {
  font-family: $font-family-code;
}

/* ===== 表格 ===== */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ===== 滚动条样式 ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: $bg-color-container;
  border-radius: $border-radius-sm;
}

::-webkit-scrollbar-thumb {
  background: $color-text-quaternary;
  border-radius: $border-radius-sm;
  transition: background $transition-fast;

  &:hover {
    background: $color-text-tertiary;
  }
}

/* ===== 选择文本样式 ===== */
::selection {
  background: $color-primary-light-8;
  color: $color-primary-dark-2;
}

/* ===== 焦点样式 ===== */
:focus-visible {
  outline: 2px solid $color-primary;
  outline-offset: 2px;
}

/* ===== 工具类 ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
